
# ResponseModel.rb
# Actions to take depending on the situation.

require 'game/Bullet'

module ResponseModel

  # Make the fighter turn to the left.
  def turn_left(amount=2.5)
    lambda{
      @angle -= amount
    }
  end

  # Make the fighter turn to the right.
  def turn_right(amount=2.5)
    lambda{
      @angle += amount
    }
  end

  # Make the fighter move forward.
  def accelerate
    lambda{
      @vel_x += Gosu::offset_x(@angle, 0.3)
      @vel_y += Gosu::offset_y(@angle, 0.3)
    }
  end

  # Push the trigger and fire.
  def shoot
    lambda{
      bullet = Bullet.new(self, @bullet_options)

      bullet.place(@pos_x, @pos_y)
      bullet.fire(@angle, @bullet_burst)
      @bullets.push(bullet)
      
      inc_stat(:shots)
      bounce_back
    }
  end

  # Do nothing.
  def stop
    lambda{}
  end

end
